//
//  PhotoBrowserProgressView.swift
//  XLWB
//
//  Created by 郭亮 on 16/3/22.
//  Copyright © 2016年 gl. All rights reserved.
//

import UIKit

class PhotoBrowserProgressView: UIView {
    // MARK:-属性
    var progress: CGFloat = 0 {
        didSet {
        setNeedsDisplay()
        }
    }
    
    override func drawRect(rect: CGRect) {
        super.drawRect(rect)
        //创建路径
        let center = CGPointMake(rect.width * 0.5, rect.height * 0.5)
        let radius = rect.width * 0.5 - 1
        let startA = CGFloat(-M_PI_2)
        let endA = progress * CGFloat(M_PI * 2) + startA
        let path = UIBezierPath(arcCenter: center, radius: radius, startAngle: startA, endAngle: endA, clockwise: true)
        path.addLineToPoint(center)
        path.closePath()
        UIColor(white: 0.8, alpha: 0.5).setFill()
        path.fill()
    }

}
